package com.yuhs.zixing.study.multithread.mashibing.t001base.t001.concept;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * Function: 线程概念 001 一个程序 不同的执行路径
 *
 * @Author yuhongsheng
 * @Date: 2023-12-17 20:03:24
 */
@Slf4j
public class Thread001 extends Thread{


    @SneakyThrows
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            TimeUnit.SECONDS.sleep(1);
            log.atInfo().log("子线程 {}",Thread.currentThread().getName());
        }
    }

    @SneakyThrows
    public static void main(String[] args) {
        Thread001 thread001 = new Thread001();
        thread001.start();
        for (int i = 0; i < 5; i++) {
            TimeUnit.SECONDS.sleep(1);
            log.atInfo().log("主线程 {}",Thread.currentThread().getName());
        }
    }
}
